1. Field of the Invention
The present invention relates to an arithmetic device for performing division of floating point numbers or for performing square root operations, and also relates to an arithmetic method therefor.
2. Description of the Related Art
In recent years, various floating point arithmetic instructions are prepared as the instruction set architectures and arithmetic devices used for executing such floating point arithmetic instructions are provided in CPUs (Central Processing Units) in information processing devices such as server computers, personal computers, and the like (see Patent Documents 1 and 2 listed below).
The SRT (Sweeney-Robertson-Tocher) method, the Newton-Raphson method, the Goldschmidt method, etc. are employed as arithmetic algorithms for division and square root operations of floating point numbers. In these arithmetic methods, loop handling such as described below is performed.
1. SRT Method
                                          (            1            )                    ⁢                                          ⁢          Division                ⁢                                  ⁢                                  ⁢                              r            ⁡                          (              0              )                                =          opl_frac                ⁢                                  ⁢                                  ⁢                              for            ⁢                                                  ⁢            n                    =                                    0              ⁢                                                          ⁢              to              ⁢                                                          ⁢              n                        =            k                          ⁢                                  ⁢                                  ⁢                              r            ⁡                          (                              n                +                1                            )                                =                      2            ⁢                          {                                                r                  ⁡                                      (                    n                    )                                                  -                                                      q                    ⁡                                          (                                              n                        +                        1                                            )                                                        *                  op                  ⁢                                                                          ⁢                  2                                            }                                      ⁢                                  ⁢                                  ⁢                                            if              ⁢                                                          ⁢                              r                ⁡                                  (                  n                  )                                                      ≈            0                    ,                                    q              ⁡                              (                                  n                  +                  1                                )                                      =            0                          ⁢                                  ⁢                                  ⁢                                            else              ⁢                                                          ⁢              if              ⁢                                                          ⁢                              r                ⁡                                  (                  n                  )                                                      >            0                    ,                                    q              ⁡                              (                                  n                  +                  1                                )                                      =            1                          ⁢                                  ⁢                                  ⁢                                            else              ⁢                                                          ⁢              if              ⁢                                                          ⁢                              r                ⁡                                  (                  n                  )                                                      <            0                    ,                                    q              ⁡                              (                                  n                  +                  1                                )                                      =                          -              1                                      ⁢                                  ⁢                                  ⁢                  n          =                      n            +            1                          ⁢                                  ⁢                                  ⁢        end                                                                                                (              2              )                        ⁢                                                  ⁢            Square            ⁢                                                  ⁢            root            ⁢                                                  ⁢            operation                    ⁢                                          ⁢                                          ⁢                                    r              ⁡                              (                0                )                                      =                          op              ⁢                                                          ⁢              2              ⁢              _frac                                ⁢                                          ⁢                                          ⁢                                    for              ⁢                                                          ⁢              n                        =                                          0                ⁢                                                                  ⁢                to                ⁢                                                                  ⁢                n                            =              k                                ⁢                                          ⁢                                          ⁢                                    r              ⁡                              (                                  n                  +                  1                                )                                      =                          2              ⁢                              {                                                      r                    ⁡                                          (                      n                      )                                                        -                                      2                    ⁢                                          q                      ⁡                                              (                                                  n                          +                          1                                                )                                                              *                                          Q                      ⁡                                              (                        n                        )                                                                              -                                      2                    ⁢                                          (                                              k                        -                        n                        -                        1                                            )                                                                      }                                              ⁢                                          ⁢                                                                                                                              ⁢                                                            Q                      ⁡                                              (                        n                        )                                                              =                                        ⁢                                                                  Σ                        ⁡                                                  (                                                      m                            =                                                          1                              →                              n                                                                                )                                                                    ⁢                      2                      ⁢                                              (                                                  k                          -                          m                                                )                                            *                                              q                        ⁡                                                  (                          m                          )                                                                                                                                                                                          =                                    ⁢                                      parital                    ⁢                                                                                  ⁢                    quotient                                                                                ⁢                                          ⁢                                          ⁢                                                    if                ⁢                                                                  ⁢                                  r                  ⁡                                      (                    n                    )                                                              ≈              0                        ,                                          q                ⁡                                  (                                      n                    +                    1                                    )                                            =              0                                      ⁢                                  ⁢                                  ⁢                                            else              ⁢                                                          ⁢              if              ⁢                                                          ⁢                              r                ⁡                                  (                  n                  )                                                      >            0                    ,                                    q              ⁡                              (                                  n                  +                  1                                )                                      =            1                          ⁢                                  ⁢                                  ⁢                                            else              ⁢                                                          ⁢              if              ⁢                                                          ⁢                              r                ⁡                                  (                  n                  )                                                      <            0                    ,                                    q              ⁡                              (                                  n                  +                  1                                )                                      =                          -              1                                      ⁢                                  ⁢                                  ⁢                  n          =                      n            +            1                          ⁢                                  ⁢                                  ⁢        end                                        2. Multiplying Arithmetic Method (Goldschmidt Method)
                                                        (              1              )                        ⁢                                                  ⁢            Division                    ⁢                                          ⁢                                          ⁢                                    for              ⁢                                                          ⁢              n                        =                                          0                ⁢                                                                  ⁢                to                ⁢                                                                  ⁢                n                            =              k                                ⁢                                          ⁢                                          ⁢                      Gn            =                                          Gn                -                                  1                  *                  Fn                                -                                  1                  ⁢                                                                          ⁢                  G                  ⁢                                                                          ⁢                  0                                            =                              OP                ⁢                                                                  ⁢                2                                              ⁢                                          ⁢                                          ⁢                      Qn            =                                          Qn                -                                  1                  *                  Fn                                -                                  1                  ⁢                                                                          ⁢                  Q                  ⁢                                                                          ⁢                  0                                            =                              OP                ⁢                                                                  ⁢                1                                              ⁢                                          ⁢                                          ⁢                      Fn            =                          2              -                              Gn                ⁢                                                                  ⁢                F                ⁢                                                                  ⁢                                                      0                    ~                    1                                    /                  OP                                ⁢                                                                  ⁢                2                ⁢                                                                  ⁢                                  (                  table                  )                                                                    ⁢                                  ⁢                                  ⁢        end                                                                                                                (                2                )                            ⁢                                                          ⁢              Square              ⁢                                                          ⁢              root              ⁢                                                          ⁢              operation                        ⁢                                                  ⁢                                                  ⁢                          for              ⁢                                                          ⁢              n                                =                                    0              ⁢                                                          ⁢              to              ⁢                                                          ⁢              n                        =            k                          ⁢                                  ⁢                                  ⁢                  Xn          =                                                                                          (                                          Xn                      -                      1                                        )                                    ⋀                  2                                *                rn                            -                              1                ⁢                                                                  ⁢                X                ⁢                                                                  ⁢                0                                      =                          OP              ⁢                                                          ⁢              2                                      ⁢                                  ⁢                                  ⁢                  Bn          =                                    Bn              -                              1                *                rn                            -                              1                ⁢                                                                  ⁢                B                ⁢                                                                  ⁢                0                                      =                          OP              ⁢                                                          ⁢              2                                      ⁢                                  ⁢                                  ⁢                  rn          =                      1            +                                          1                /                2                            ⁢                              (                                  1                  -                  Xn                                )                            ⁢                                                          ⁢              r              ⁢                                                          ⁢                              0                ~                1                            ⁢                              √                OP                            ⁢                                                          ⁢              2              ⁢                                                          ⁢                              (                table                )                                                    ⁢                                  ⁢                                  ⁢        end                                        
FIG. 1 shows a configuration of the above described conventional arithmetic device for performing division and square root operations of floating point numbers. The arithmetic device shown in FIG. 1 includes registers 11, 12, 15 through 18, 21, 22, 26, 29, and 30, a fraction digit adjustment shifters 13 and 14, selectors 19, 20, and 31, a special operand processing circuit 23, an exponent computation circuit 24, a fraction computation circuit 25, a fraction rounding circuit 27, and a fraction normalization shifter 28.
The special operand processing circuit 23 does not cause the computation unit to perform a usual computation process when two operands op1 and op2 are prescribed data, but causes the computation unit to perform exception handling such as a special operand process that outputs computation results of a fixed value data for the prescribed operand or error handling, or the like. The exponent computation circuit 24 performs the computation of the exponents of op1 and op2. Also, the fraction computation circuit 25 performs division and square root operation of the fractions of op1 and op2.
In the above floating point arithmetics, the computation results output from the fraction computation circuit 25 are not always the normalized numbers (this will be explained later). Further, the rounding process by using the fraction rounding circuit 27 is performed on the computation results, however, there is a probability that the most significant bit is carried over after the rounding process. Thus, usually, after the rounding process, the normalization shifting is performed on the fraction by using the fraction normalization shifter 28, and the value in accordance with the shifted amount is added to the exponent by using the register 29.
FIG. 2 shows a configuration of the special operand processing circuit 23 shown in FIG. 1. The special operand processing circuit 23 includes a special operand detection circuit 41 and a generation circuit 42. The special operand detection circuit 41 detects, on the basis of the values of op1 and op2 that are the computation target operands, the operands that have to undergo the special operand process or the exception handling, outputs the detection signals to the generation circuit 42, and outputs a selection signal denoted by “sel normal/special”.
The generation circuit 42 generates a special computation result or an exception flag on the basis of the detection signal from the special operand detection circuit 41, a rounding mode designation signal rd defined in a specification for floating point number arithmetics whose representative example is the IEEE (Institute of Electrical and Electronic Engineers) 754, and the overflow/underflow detection signal “exp ovf/udf” from the exponent computation circuit 24, and outputs it as the signal denoted by “special res”.
The selector 31 shown in FIG. 1 operates in accordance with the selection signal “sel normal/special”, selects the signal “special res” output from the generation circuit 42 or a normal computation result that is generated by the exponent computation circuit 24 and the fraction computation circuit 25 in order to output the selected signal/result.
However, the above conventional arithmetic device has the problems as described below.
In division and square root operations of floating point numbers, results of the fraction computation circuit 25 are not always the normalized numbers, accordingly the results of the rounding process influences the computation results of the exponent.
Then, the selection signal for the fraction normalization shifter 28 and the input signal for the register 29 used for the addition of exponent are generated from a carry out signal of the incrementer in the fraction rounding circuit 27 or the significant bit signal that corresponds to the carry out signal. Accordingly, because it takes substantial time for the carry of the incrementer to arrive at the carry out signal or the significant bit signal, these signals can often serve as a bottle neck in view of the delay. Also, there is a probability that the overflow or underflow can be caused in the exponent computation circuit 24 depending on the results of the exponent addition. Thus, exception handling for the addition results has to be prepared to be performed after the addition.
As described above, the flow of data starting from the computation results in the fraction computation circuit 25 has been a factor that prevents the arithmetic devices from increasing the computation speed, and also has been a factor that complicates the circuit configurations.    Patent Document 1:    Japanese Patent Application Publication No. 07-182143    Patent Document 2:    Publication of Japanese Translation of PCT application No. 04-507023